﻿using System;



class NarcissisticNumbers

{

    static void Main()

    {

        Console.WriteLine("所有的水仙花数（100-999之间）：");

        int count = 0;

        for (int num = 100; num < 1000; num++)

        {

            string numStr = num.ToString();

            int digit1 = int.Parse(numStr[0].ToString());

            int digit2 = int.Parse(numStr[1].ToString());

            int digit3 = int.Parse(numStr[2].ToString());



            int sum = digit1 * digit1 * digit1 +

                     digit2 * digit2 * digit2 +

                     digit3 * digit3 * digit3;



            if (sum == num)

            {

                Console.WriteLine($"{num} = {digit1}³ + {digit2}³ + {digit3}³");

                count++;

            }

        }

        Console.WriteLine($"\n总共 {count} 个水仙花数");

    }

}